public class Homework {
}
class Person{

    String name = "Person";

    int age=0;

}

class Child extends Person{

    public String grade;

    public static void main(String[] args){

        Person p = new Child();

        System.out.println(p.name);

    }

}
class Base1 {
    Base1() {
        System.out.print("Base");
    }
}

class Alpha extends Base1 {

    public static void main( String[] args ) {
//        new Alpha();//1
        new Alpha();
        //调用父类无参的构造方法
        new Base1();//2
    }
}
/*class Base{
    public Base(String s){
        System.out.print("B");
    }
}*/
class Base{
    public Base(){
        System.out.print("B");
    }
}
//如果父类的构造方法不含参数，那么子类构造方法时是否需要人为帮助父类调用父类的构造方法？不需要！！！！
class Derived extends Base{
    public Derived (String s) {
        super();
        System.out.print("D");
    }
    public static void main(String[] args){
        new Derived("123");//调用方法才能实现方法/传参传了个寂寞
    }
}
class X{
    Y y=new Y();//1
    public X(){//2
        System.out.print("X");
    }
}
class Y{
    public Y(){//3
        System.out.print("Y");
    }
}
class Z extends X{
    Y y=new Y();//4        Y
    public Z(){//5
        super();//YX/XY?     构造方法是否再调用类时最早执行？
        System.out.print("Z");
    }
    public static void main(String[] args) {
        new Z();
    }
}
